package com.zxblog.service.impl;

import com.zxblog.domain.Article;
import com.zxblog.mapper.ArticleMapper;
import com.zxblog.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    @Override
    public Article publishArticle(Integer uid, String articleContentText,Integer zoneId) {
        Article article = new Article();
        article.setUid(uid);
        article.setArticlelikes(0);
        article.setArticlecontenttext(articleContentText);
        article.setUid(uid);
        if (zoneId != null){
            article.setZoneid(zoneId);
        }
        articleMapper.insertSelective(article);
        return article;
    }
}
